package com.sheng.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.dubbo.config.annotation.Service;
import com.sheng.entity.Product;
import com.sheng.mapper.ProductMapper;
import com.sheng.service.ProductService;
import com.sheng.utils.Assert;

@Service
public class ProductServiceImpl implements ProductService {
	
	@Autowired
	private ProductMapper productMapper;

	@Override
	public void createProduct() {
//		Assert.notBlank(str, message);
		this.productMapper.createProduct("测试产品", "10001", 200, 100, "费用详情", "产品描述");
	}
	
	@Override
	public void remove(Integer productId){
		this.productMapper.removeProduct(productId);
	}
	
	@Override
	public Product getProduct(Integer productId) {
//		return this.productMapper.getProduct(productId);
		return this.productMapper.selectByPrimaryKey(productId);
	}
	
	@Override
	public List<Product> findProductAllList() {
		return this.productMapper.findProductAllList();
	}
	
	@Override
	public void updateProduct(Product product){
		this.productMapper.updateProduct(product);
	}
	
	@Override
	public List<Product> findProductListByCondition(Product product){
		return this.productMapper.findProductListByCondition(product);
	}
	
}
